package cn.dianchiyun.protocol.netty.dtu.handler.impl;

import cn.dianchiyun.protocol.netty.dtu.entity.DTUWrite;
import cn.dianchiyun.protocol.netty.utils.HexUtil;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

public class EncodeHandler extends MessageToByteEncoder<DTUWrite>{

	@Override
	protected void encode(ChannelHandlerContext ctx, DTUWrite msg, ByteBuf out) throws Exception {
		out.writeBytes(HexUtil.hexString2Bytes(msg.getCRCString()));
	}

}
